﻿<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<KaoWuYou.Models.TestPaperListModel>" %>

<asp:Content ID="Content" ContentPlaceHolderID="MainContent" runat="server">

    <div class="navi">
        <div class="pageTitle">
            <h1>试卷一览</h1>
        </div>
        <ul>
         <% if ((Model.TestPaperModels != null) && (Model.Page > 0) && (Model.Page <= (Model.TestPaperModels.Count - 1) / 10 + 1)) 
            { 
                int head = 10 * (Model.Page - 1);
                for (int i = head; (i < head + 10) && (i < Model.TestPaperModels.Count); i++)
                { %>
                    <li class="item" style=" min-height:100px;">
                        <img class="cover" src="/Content/img/papercover.png" alt="cover" style=" float:left;" />
                        <div class="info">
                            <h3>
                                <%: Model.TestPaperModels[i].TestPaperName%>
                                <small class="grey">
                                    <br />
                                    <%: Model.TestPaperModels[i].Questions.Count%>
                                    <br />
                                    <%: Model.TestPaperModels[i].TotalMark%>
                                </small>
                            </h3>
                        </div>
                        <div class="examBtn" style="bottom: 132px">
                            <%: Html.ActionLink("开始考试", "Test", new { TestPaperID = Model.TestPaperModels[i].TestPaperID })%>
                        </div>
                    </li>
             <% }
            } %>
        </ul>
    </div>
 <% if (Model.Page<(Model.TestPaperModels.Count-1) / 10+1) 
    { %>
        <div class="defBtn" style=" float: right; margin: 20px 20px 20px 20px;">
            <%: Html.ActionLink("下一页", "TestPaperList", new { 
                                                                   SubjectID = Model.SubjectID, 
                                                                   SubclassID = Model.SubclassID, 
                                                                   Page = Model.Page + 1 > (Model.TestPaperModels.Count - 1) / 10 + 1 ? (Model.TestPaperModels.Count - 1) / 10 + 1 : Model.Page + 1 
                                                               }) %>
        </div>
 <% } 
    else 
    { %> 
        <div class="defBtn" style=" float: right; margin: 20px 56px 56px 20px;"></div> 
 <% } %>

 <% if (Model.Page>1) 
    { %>
        <div class="defBtn" style=" float: right; margin: 20px 20px 20px 20px;">
            <%: Html.ActionLink("上一页", "TestPaperList", new { 
                                                                   SubjectID = Model.SubjectID, 
                                                                   SubclassID = Model.SubclassID, 
                                                                   Page = Model.Page - 1 < 1 ? 1 : Model.Page - 1 
                                                               }) %>
        </div>
 <% } 
    else 
    { %> 
        <div class="defBtn" style=" float: right; margin: 20px 56px 56px 20px;"></div> 
 <% } %>

</asp:Content>
